package com.elong.android.specialhouse.ui;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.widget.TextView;

/**
 * 带我们自定义下划线的编辑框
 * Created by cheng.wang on 2015/9/1.
 */
public class UnderLineView extends TextView {
    private Paint paint;
    public UnderLineView(Context context) {
        super(context);
        init();
    }


    public UnderLineView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    private void init() {
        paint = new Paint();
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);

        paint.setColor(Color.parseColor("#d9d8dc"));

        int width = this.getMeasuredWidth();
        int height = this.getMeasuredHeight();

        canvas.drawLine(1, 0, 0, height-1, paint);
        canvas.drawLine(0, height - 1, width - 1, height - 1, paint);
        canvas.drawLine(width - 1, height - 1, width - 1, 0, paint);
    }
}
